/*
 * @Author: 肖思汗 
 * @Date: 2025-06-11 14:50:54 
 * @Last Modified by: 肖思汗
 * @Last Modified time: 2025-06-11 14:59:58
 */

import Api from "src/api/Api";
import { MyDesignData } from "types/type";

//接口模版
class MyDesignApi extends Api {

    constructor() {
        super();
    }

    //添加
    add() {
        return this._post("", {});
    }

    // 获取我的设计
    getList(pageNum: number = 1, pageSize: number = 10) {
        return this._get("/appUserDesign/list", { pageNum, pageSize });
    }

    // 编辑
    edit(myDesignData: MyDesignData) {
        const { id, productId, productNegativeId, productDesign, designName, size, color } = myDesignData;
        return this._post("/appUserDesign/editDesign", {
            id,
            productId,
            designName,
            productNegativeId,
            productDesign: JSON.stringify(productDesign),
            size,
            color
        });
    }

    // 删除我的设计
    delete(designIds: string) {
        return this._get(`/appUserDesign/batchDeleteDesign/${designIds}`);
    }

}

const myDesignApi = new MyDesignApi();

export default myDesignApi;